package com.example.evanproject.mapper;

import com.example.evanproject.domain.Trends;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
* @author hanxiaoqi
* @description 针对表【trends】的数据库操作Mapper
* @createDate 2024-03-09 21:52:13
* @Entity generator.domain.Trends
*/
@Mapper
public interface TrendsMapper extends BaseMapper<Trends> {
    List<Trends> getParentChildTree(Integer id);

    Trends getlistbyid(Integer id);


    //首先返回个人的评论(父id为null的评论)
    List<Trends> filterbigpeople(Integer userid);


    //   发布动态（最原始的动态）
    @Insert("insert into trends(content,create_time,user_id,img) values (#{text},#{time},#{userid},#{img})")
    Integer updatelistinfo(String time, String text, Integer userid, String img);


    @Insert("insert into trends(content,create_time,parent_id,user_id) values (#{text},#{time},#{fid},#{userid})")
    Integer updatecomment(Integer userid, Integer fid, String text, String time);

    //    返回所有的动态
    List<Trends> selectall();


    //    删除动态
    @Delete("delete from trends where id=#{treandid}")
    Integer deletetrends(Integer treandid);



}




